﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;


namespace Kaz.HolidayManagementSystem.Client.Controllers.Employee
{
    public class EmployeeController : Controller
    {
      
        public ActionResult Index()
        {
            return View();
        }
        
        public ActionResult Details(int id)
        {
            return View();
        }

      
        public ActionResult Create()
        {
            return View(new Business.DomainObjects.Employee());
        }
      
        [HttpPost]
        public ActionResult Create(Business.DomainObjects.Employee employee)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    employee.Save();
                    return RedirectToAction("Details", new { id = employee.Id });
                }
                catch (Exception ex)
                {
                    //ModelState.AddModelError(ex.Message, ex);
                }

            }
            return View(employee);
        }


        public ActionResult Edit(int id)
        {
            return View();
        }


        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }


    }
}
